﻿using UnityEngine;
using UnityEngine.UI;
using Entitas;
class PlayerHealthBarView : MonoBehaviour,IPlayerHitPointListener
{
    Slider slider;
    public void OnHitPoint(PlayerEntity entity, int value)
    {
     
         slider.value = value;
    }
    private void Start()
    {
        slider = GetComponent<Slider>();

        if (Contexts.sharedInstance.player.count == 1)
        {
            Contexts.sharedInstance.player.GetEntities().SingleEntity<PlayerEntity>().AddPlayerHitPointListener(this);
        }
        
    }
}